<template>
	<view class="login">
		
		<view class="head">
			<view class="title">
				<image src="../../static/img/tabbar/homeactive.png" mode=""></image>
				<text>登录您的AWE账号</text>
			</view>
			<view class="btn" @tap="goToReg">注册账号</view>
		</view>
		
		<view class="content">
			<view class="tabs">
				<view class="item" :class="{active: tabsIndex === index}" v-for="(item,index) in tabs" @tap="tabsToggl(index)">{{item}}</view>
			</view>
			<view class="form-box">
				<template v-if="tabsIndex === 0">
					<uni-forms class="login-form" ref="form" label-position="top">
						<uni-forms-item name="text" label="">
							<view class="login-zone" @tap="goto">
								中国 +86 <uni-icons type="arrowdown" size="18"></uni-icons>
							</view>
							<uni-easyinput class="input" type="text" :inputBorder="false" v-model="formData.text" placeholder="请输入您的手机号码"></uni-easyinput>
						</uni-forms-item>
						<uni-forms-item name="password" label="密码">
							<uni-easyinput class="input" type="password" :inputBorder="false" v-model="formData.secreKey" placeholder="******"></uni-easyinput>
						</uni-forms-item>
					</uni-forms>
				</template>
				<template v-if="tabsIndex === 1">
					<uni-forms class="login-form" ref="form" label-position="top">
						<uni-forms-item name="mail" label="">
							<view class="login-zone">邮箱</view>
							<uni-easyinput class="input" type="mail" :inputBorder="false" v-model="formData.mail" placeholder="请输入您的邮箱"></uni-easyinput>
						</uni-forms-item>
						<uni-forms-item name="password" label="密码">
							<uni-easyinput class="input" type="password" :inputBorder="false" v-model="formData.secreKey" placeholder="******"></uni-easyinput>
						</uni-forms-item>
					</uni-forms>
				</template>
				<view class="footer">
					<view class="forget">忘记密码</view>
					<button type="primary">立即登录</button>
				</view>
			</view>
		</view>
		
		<view class="fab" @tap="goToHome">
			<image src="../../static/img/backhome_icon.png" mode=""></image>
		</view>
				
	</view>
</template>

<script>
	export default {
		data() {
			return {
				tabsIndex: 0,
				tabs: ['手机登录', '邮箱登录'],
				isIphoneLogin: true,
				formData: {},
				pagesLength: 0,
			}
		},
		onNavigationBarButtonTap() {
			
		},
		onLoad() {
		},
		mounted() {
			
		},
		methods: {
			goto() {
				uni.navigateTo({
					url: "../zoneIndexList/zoneIndexList"
				})
			},
			trggerLogin() {
				this.isIphoneLogin = !this.isIphoneLogin
			},
			goToReg() {
				uni.navigateTo({
					url: "./registerFirstSteps"
				})
			},
			// tabs 切换
			tabsToggl(e) {
				this.tabsIndex = e;
			},
			// 跳转到首页
			goToHome(){
				uni.switchTab({
					url: "/pages/tabbar/tabbar-1/tabbar-1"
				})
			}
		}
	}
</script>

<style>
	@import url("@/common/login.css");
	.login .fab {
		display: flex;
		justify-content: center;
		align-items: center;
		position: fixed;
		right: 5%;
		bottom: 15%;
		width: 80rpx;
		height: 80rpx;
		line-height: 80rpx;
		text-align: center;
		border-radius: 50%;
		box-shadow: 0 0px 10px rgb(0 0 0 / 20%), 0 0px 0px rgb(0 0 0 / 20%);
	}
	.login .fab image {
		width: 40rpx;
		height: 40rpx;
	}
</style>
